package com.shuda.business.crm.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.LocalDateTime;

/**
 * 客户实体类
 */
@TableName("crm_customer")
@Schema(name = "CustomerEntity", description = "客户实体")
public class CustomerEntity {

    @TableId(type = IdType.AUTO)
    @Schema(description = "客户ID")
    private Long id;

    @Schema(description = "客户姓名")
    private String customerName;

    @Schema(description = "客户手机号")
    private String customerPhone;

    @Schema(description = "客户邮箱")
    private String customerEmail;

    @Schema(description = "客户状态(active-活跃,inactive-不活跃,potential-潜在)")
    private String customerStatus;

    @Schema(description = "客户级别(A-重要客户,B-普通客户,C-一般客户)")
    private String customerLevel;

    @Schema(description = "客户来源")
    private String customerSource;

    @Schema(description = "客户行业")
    private String customerIndustry;

    @Schema(description = "客户公司")
    private String customerCompany;

    @Schema(description = "客户职位")
    private String customerPosition;

    @Schema(description = "客户地址")
    private String customerAddress;

    @Schema(description = "客户备注")
    private String customerRemark;

    // ===== 兼容 CrmServiceImpl 所需字段（移除Lombok，显式提供访问器） =====
    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "身份证号")
    private String idCard;

    @Schema(description = "年龄")
    private Integer age;

    @Schema(description = "性别")
    private String gender;

    @Schema(description = "学历")
    private String education;

    @Schema(description = "职业")
    private String occupation;

    @Schema(description = "月收入")
    private String monthlyIncome;

    @Schema(description = "所在城市")
    private String city;

    @Schema(description = "详细地址")
    private String address;

    @Schema(description = "微信号")
    private String wechat;

    @Schema(description = "QQ号")
    private String qq;

    @Schema(description = "邮箱（通用字段）")
    private String email;

    @Schema(description = "客户来源（通用字段）")
    private String source;

    @Schema(description = "渠道ID")
    private Long channelId;

    @Schema(description = "渠道名称")
    private String channelName;

    @Schema(description = "产品类型")
    private String productType;

    @Schema(description = "贷款金额")
    private String loanAmount;

    @Schema(description = "贷款期限")
    private String loanTerm;

    @Schema(description = "状态（active/inactive/potential等）")
    private String status;

    @Schema(description = "跟进状态")
    private String followUpStatus;

    @Schema(description = "分配状态")
    private String allocationStatus;

    @Schema(description = "跟进次数")
    private Integer followUpCount;

    @Schema(description = "是否有效")
    private Boolean isValid;

    @Schema(description = "备注（通用字段）")
    private String remark;

    @Schema(description = "扩展字段1")
    private String ext1;

    @Schema(description = "扩展字段2")
    private String ext2;

    @Schema(description = "扩展字段3")
    private String ext3;

    @Schema(description = "租户ID")
    private Long tenantId;

    @Schema(description = "分配用户ID")
    private Long assignedUserId;

    @Schema(description = "分配用户名称")
    private String assignedUserName;

    @Schema(description = "分配时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime assignedTime;

    @Schema(description = "最后跟进时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastFollowUpTime;

    @Schema(description = "下次跟进时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime nextFollowUpTime;

    @Schema(description = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "逻辑删除标识(0-未删除,1-已删除)")
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public String getCustomerPhone() {
        return customerPhone;
    }

    public void setCustomerPhone(String customerPhone) {
        this.customerPhone = customerPhone;
    }

    public String getCustomerEmail() {
        return customerEmail;
    }

    public void setCustomerEmail(String customerEmail) {
        this.customerEmail = customerEmail;
    }

    public String getCustomerStatus() {
        return customerStatus;
    }

    public void setCustomerStatus(String customerStatus) {
        this.customerStatus = customerStatus;
    }

    public String getCustomerLevel() {
        return customerLevel;
    }

    public void setCustomerLevel(String customerLevel) {
        this.customerLevel = customerLevel;
    }

    public String getCustomerSource() {
        return customerSource;
    }

    public void setCustomerSource(String customerSource) {
        this.customerSource = customerSource;
    }

    public String getCustomerIndustry() {
        return customerIndustry;
    }

    public void setCustomerIndustry(String customerIndustry) {
        this.customerIndustry = customerIndustry;
    }

    public String getCustomerCompany() {
        return customerCompany;
    }

    public void setCustomerCompany(String customerCompany) {
        this.customerCompany = customerCompany;
    }

    public String getCustomerPosition() {
        return customerPosition;
    }

    public void setCustomerPosition(String customerPosition) {
        this.customerPosition = customerPosition;
    }

    public String getCustomerAddress() {
        return customerAddress;
    }

    public void setCustomerAddress(String customerAddress) {
        this.customerAddress = customerAddress;
    }

    public String getCustomerRemark() {
        return customerRemark;
    }

    public void setCustomerRemark(String customerRemark) {
        this.customerRemark = customerRemark;
    }

    public Long getAssignedUserId() {
        return assignedUserId;
    }

    public void setAssignedUserId(Long assignedUserId) {
        this.assignedUserId = assignedUserId;
    }

    public String getAssignedUserName() {
        return assignedUserName;
    }

    public void setAssignedUserName(String assignedUserName) {
        this.assignedUserName = assignedUserName;
    }

    /**
     *
     * 兼容通用字段访问器
     * @param $params$
     * @return $returns$
     * @author ink
     * @Description: 明确提供getter/setter，确保CrmServiceImpl编译通过
     * @date 2025-11-09 23:55
     */
    public String getPhone() { return phone; }
    public void setPhone(String phone) { this.phone = phone; }

    public String getIdCard() { return idCard; }
    public void setIdCard(String idCard) { this.idCard = idCard; }

    public Integer getAge() { return age; }
    public void setAge(Integer age) { this.age = age; }

    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }

    public String getEducation() { return education; }
    public void setEducation(String education) { this.education = education; }

    public String getOccupation() { return occupation; }
    public void setOccupation(String occupation) { this.occupation = occupation; }

    public String getMonthlyIncome() { return monthlyIncome; }
    public void setMonthlyIncome(String monthlyIncome) { this.monthlyIncome = monthlyIncome; }

    public String getCity() { return city; }
    public void setCity(String city) { this.city = city; }

    public String getAddress() { return address; }
    public void setAddress(String address) { this.address = address; }

    public String getWechat() { return wechat; }
    public void setWechat(String wechat) { this.wechat = wechat; }

    public String getQq() { return qq; }
    public void setQq(String qq) { this.qq = qq; }

    public String getEmail() { return email; }
    public void setEmail(String email) { this.email = email; }

    public String getSource() { return source; }
    public void setSource(String source) { this.source = source; }

    public Long getChannelId() { return channelId; }
    public void setChannelId(Long channelId) { this.channelId = channelId; }

    public String getChannelName() { return channelName; }
    public void setChannelName(String channelName) { this.channelName = channelName; }

    public String getProductType() { return productType; }
    public void setProductType(String productType) { this.productType = productType; }

    public String getLoanAmount() { return loanAmount; }
    public void setLoanAmount(String loanAmount) { this.loanAmount = loanAmount; }

    public String getLoanTerm() { return loanTerm; }
    public void setLoanTerm(String loanTerm) { this.loanTerm = loanTerm; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public String getFollowUpStatus() { return followUpStatus; }
    public void setFollowUpStatus(String followUpStatus) { this.followUpStatus = followUpStatus; }

    public String getAllocationStatus() { return allocationStatus; }
    public void setAllocationStatus(String allocationStatus) { this.allocationStatus = allocationStatus; }

    public Integer getFollowUpCount() { return followUpCount; }
    public void setFollowUpCount(Integer followUpCount) { this.followUpCount = followUpCount; }

    public Boolean getIsValid() { return isValid; }
    public void setIsValid(Boolean isValid) { this.isValid = isValid; }

    public String getRemark() { return remark; }
    public void setRemark(String remark) { this.remark = remark; }

    public String getExt1() { return ext1; }
    public void setExt1(String ext1) { this.ext1 = ext1; }

    public String getExt2() { return ext2; }
    public void setExt2(String ext2) { this.ext2 = ext2; }

    public String getExt3() { return ext3; }
    public void setExt3(String ext3) { this.ext3 = ext3; }

    public Long getTenantId() { return tenantId; }
    public void setTenantId(Long tenantId) { this.tenantId = tenantId; }

    public LocalDateTime getAssignedTime() { return assignedTime; }
    public void setAssignedTime(LocalDateTime assignedTime) { this.assignedTime = assignedTime; }

    public LocalDateTime getLastFollowUpTime() {
        return lastFollowUpTime;
    }

    public void setLastFollowUpTime(LocalDateTime lastFollowUpTime) {
        this.lastFollowUpTime = lastFollowUpTime;
    }

    public LocalDateTime getNextFollowUpTime() {
        return nextFollowUpTime;
    }

    public void setNextFollowUpTime(LocalDateTime nextFollowUpTime) {
        this.nextFollowUpTime = nextFollowUpTime;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }
}